package com.wandian.message.mvvm.mymessage;

import android.os.Bundle;

import androidx.databinding.DataBindingUtil;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mylib.libcore.AppContext;
import com.mylib.libcore.bean.UserInfoBean;
import com.mylib.libcore.config.RouterConfig;
import com.mylib.libcore.mvvm.BaseMVVMActivity;
import com.mylib.libcore.utils.StatusBarUtils;
import com.wandian.message.R;
import com.wandian.message.databinding.MessageActivityMyMessageBinding;

/**
 * @author Administrator
 * @date 2019/12/18-14:28
 * @description 我的消息
 **/
@Route(path = RouterConfig.ROUTER_ACTIVITY_MY_MESSAGE)
public class MyMessageActivity extends BaseMVVMActivity<MyMessageViewModel> {
    private MessageActivityMyMessageBinding dataBinding;
    @Override
    public void init(Bundle savedInstanceState) {
        dataBinding = DataBindingUtil.setContentView(this, R.layout.message_activity_my_message);
        dataBinding.setLifecycleOwner(this);
        dataBinding.setViewModel(mViewModel);
        initViewData();
        initClink();
    }
    private void initViewData(){
        //设置状态颜色和字体黑色
        StatusBarUtils.with(this,false)
                .setIsActionBar(false)
                .clearActionBarShadow()
                .setDrawable(getResources().getDrawable(com.mylib.libcore.R.drawable.sys_color))
                .init();
        dataBinding.bindSysToolBar.toolBarTvTitle.setText("我的消息");


        dataBinding.bindMessageStyleNextPage1.ivIcon.setBackgroundResource(R.drawable.img_msg_message_at);
        dataBinding.bindMessageStyleNextPage1.tvLeft.setText("评论");

        dataBinding.bindMessageStyleNextPage2.ivIcon.setBackgroundResource(R.drawable.img_msg_message_fs);
        dataBinding.bindMessageStyleNextPage2.tvLeft.setText("围栏");

        dataBinding.bindMessageStyleNextPage3.ivIcon.setBackgroundResource(R.drawable.img_msg_message_z);
        dataBinding.bindMessageStyleNextPage3.tvLeft.setText("点赞");


    }
    private void initClink(){
        dataBinding.bindSysToolBar.toolBarIvBack.setOnClickListener(v -> {
            finishhideSoftBoard();
            finish();
        });
        //评论
        dataBinding.bindMessageStyleNextPage1.rlNextPage.setOnClickListener(v -> ARouter.getInstance().build(RouterConfig.ROUTER_ACTIVITY_MY_MESSAGE_COMMENT).navigation());

        //围栏
        dataBinding.bindMessageStyleNextPage2.rlNextPage.setOnClickListener(v -> {
            UserInfoBean userInfoBean = AppContext.getInstance().getAppPreferencesHelper().getUserInfoBean();
            Bundle bundle = new Bundle();
            bundle.putString("title","围栏");
            bundle.putString("user_id",userInfoBean.getId()+"");
            bundle.putString("user_name",userInfoBean.getNickName());
            bundle.putString("user_head",userInfoBean.getHeadPic());
            bundle.putString("form_id",userInfoBean.getId()+"");
            bundle.putString("user_des",userInfoBean.getDescription()+"");
            ARouter.getInstance().build(RouterConfig.ROUTER_ACTIVITY_SETTING_USERHEADINFO).with(bundle).navigation();
        });

        //赞
        dataBinding.bindMessageStyleNextPage3.rlNextPage.setOnClickListener(v -> ARouter.getInstance().build(RouterConfig.ROUTER_ACTIVITY_MY_MESSAGE_PRAISE).navigation());



    }


}
